package com.example.myapplication.ui.Home.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.myapplication.R;
import com.example.myapplication.model.bean.PhotoGirl;

import java.util.List;

/**
 * Created by meishiyiyun on 2017/6/12.
 */

public class CommonRecycleViewAdapter extends BaseQuickAdapter<PhotoGirl> {
    public CommonRecycleViewAdapter(int layoutResId, List<PhotoGirl> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PhotoGirl photoGirl) {
        ImageView imageView=helper.getView(R.id.iv_photo);
        Glide.with(mContext).load(photoGirl.getUrl())
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .placeholder(R.drawable.ic_image_loading)
                .error(R.drawable.ic_empty_picture)
                .centerCrop().override(1090, 1090*3/4)
                .crossFade().into(imageView);

//        imageView.setOnClickListener(view -> {
//
//        }
    }
}